package com.sq.loginservice.controller;

import com.sq.api.dto.SysUserDto;
import com.sq.common.web.domain.AjaxResult;
import com.sq.loginservice.service.RegisterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import static com.sq.common.web.domain.AjaxResult.error;
import static com.sq.common.web.domain.AjaxResult.success;

/**
 * @Author Li sir
 * @Date 2024/9/27
 */
@RestController
@RequestMapping("/api/register/")
public class RegisterController  {

    @Autowired
    private RegisterService registerService;

    @PostMapping("registerall")
    public AjaxResult userRegister(String userName){
        return success();
    }

    @PostMapping("register")
    public AjaxResult userRegister(@RequestBody SysUserDto sysUserDto){
        int i = registerService.userRegister(sysUserDto);
        return  i > 0 ? success() : error();
    }

}
